<%@ page import="com.touzi.constants.MobileCons" %>
<%@ page import="com.touzi.utils.MyHTTPUtils" %>
<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="com.touzi.constants.DbCons" %>
<%@ page import="com.touzi.mapper.UserMapper" %>
<%@ page import="org.apache.ibatis.session.SqlSessionFactory" %>
<%@ page import="com.touzi.beans.dbs.users.User" %>
<%@ page import="com.touzi.mapper.DingdanMapper" %>
<%@ page import="java.util.List" %>
<%@ page import="com.touzi.beans.dbs.dingdan.AUserDingd" %><%--
  Created by IntelliJ IDEA.
  User: w7851
  Date: 2018/5/16
  Time: 7:49
  我的订单页面
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
    Cookie usercookie = MyHTTPUtils.getCookieByName(request, MobileCons.COOKIE_USERNAME);
    String userphone = usercookie.getValue();
    SqlSession sqlSession = ((SqlSessionFactory) application.getAttribute(DbCons.DB_FACTORY)).openSession();
    UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
    User user = userMapper.findUserByDhmw(userphone).get(0);

    DingdanMapper dingdanMapper = sqlSession.getMapper(DingdanMapper.class);
    List<AUserDingd> dingds = dingdanMapper.getAUserDd(user.id);

    sqlSession.close();
    request.setAttribute("dingds", dingds);
    request.setAttribute("user", user);
%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>

    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>

    <link rel="stylesheet" href="/css/ydui.css">
    <script src="/js/ydui.flexible.js"></script>
</head>
<body>
<div class="g-flexview">
    <header class="m-navbar  navbar-fixed">
        <a onclick="goback()" class="navbar-item">
            <i class="back-ico"></i>
        </a>
        <div class="navbar-center"><span class="navbar-title">我的订单</span></div>
    </header>


    <div class="g-scrollview" style="margin-top: 1rem">
        <div class="m-celltitle">我的订单列表</div>

        <div class="m-cell">
            <c:forEach var="item" items="${dingds}">
                <a class="cell-item" href="/mobile?method=gomobilepage&page=ddfhjh&orderno=${item.dingdanhao}&title=${item.biaoti}">
                    <div class="cell-left">${item.biaoti}(￥${item.dingdanjiner})</div>
                    <div class="cell-right cell-arrow">${item.fukuanshijian}</div>
                </a>
            </c:forEach>
        </div>

    </div>
</div>
</body>
<script>
    function goback() {
        history.go(-1);
    }
</script>
</html>
